package com.gaiso.pushdemo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;

import com.gaiso.gaisopush.data.PushConstant;

/**
 * Created by hzy on 2016/3/9.
 */
public class PushReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Bundle bundle = intent.getExtras();
		switch (bundle.getInt(PushConstant.BROADCAST_ACTION)) {
			case PushConstant.GET_MSG_DATA:
				byte[] payload = bundle.getByteArray("payload");
				if (payload != null) {
					String data = new String(payload);
					if (!TextUtils.isEmpty(data)) {
						PushNotification.getInstance().showMain(data);
					}
				}
				break;

			default:
				break;
		}
	}

}
